﻿<!DOCTYPE>
<html ng-app="registerApp">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width, minimal-ui">
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="/css/pensonel.css" />
  <script src="/framework/angular-wang-editor/dist/js/lib/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="/framework/angular.min.js"></script>
    <title ng-bind="'注册-'+systemTitle"></title>
    <style type="text/css">
    .active{color: #39f; border:1px #39f solid !important;;}
    </style>
</head>

<body>
    <!-- 注册第一步-->
    <section class="content">

<div class="signup ">

<div class="formsignup">
<div class="form-unit"  ng-controller="validateCtrl" ng-cloak>
	 
	<form class="verify_form"  name="myForm" ng-show="unameregis" novalidate>
	<div class="topsigunp"><img src="/images/logo.png" alt=""></div>
	<div class="form_title">企业账号注册</div>
	<div class="form-field">
	<input type="text" name="username" id="username" placeholder="请填写邮箱/手机号" autocomplete="off" class="form-control email" ng-model="username"  ng-pattern="/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}|1[3|4|5|7|8]\d{9}$/" required set-focus dd-obj="unerr" ng-focus="userNameOnFocus()"/>
	</div>            
            <div class="form-fidld errormsg" ng-show="myForm.username.$dirty && myForm.username.$invalid && !myForm.username.$focused">
  <span ng-show="myForm.username.$error.required">邮箱/手机号不能为空</span>
  <span class="warning" ng-show="myForm.username.$error.pattern">用户名格式不正确</span>
           </div>
           
           <div class="form-fidld errormsg" ng-show="unerr && !(myForm.username.$error.required||myForm.username.$error.pattern) ">
  <span ng-show="unerr">{{unerr_msg}}</span>
           </div>
               
	<button type="submit" class="btn submit form_btn" id="zhuceid" ng-disabled="myForm.$invalid" ng-click="register1()">马上注册</button>
    
	<div class="info-field">已有账号？<a href="/login.html" target="_self" class="backdenglu">登录</a></div>
	</form>


	<!-- 注册第二步 -->
	<form class="create-bind-form"  ng-show="userinfo"  name="myForm2" novalidate>
		  <div class="topsigunp"><img src="/images/logo.png" alt=""></div>
          <div class="form-field">
            <div class="column-left">+86</div>
            <input type="tel" name="phone" id="phone" autocomplete="off"  ng-model="username" required  class="form-control phone" readonly="readonly" />
          </div>          
          <div class="form-field">            
            <input type="text" name="yanzhengma" id="yanzhengma" placeholder="验证码" autocomplete="off" class="form-control yzm" ng-model="yanzhengma" required  ng-focus/>
            <img ng-src="{{valimgurl}}" ng-click="upd_yzm()" class="timer  timerwc"/>
          </div>
          <div class="form-field">
            <input type="text" name="txt_verify" placeholder="短信验证码" autocomplete="off" class="form-control verify" ng-model="txt_verify" required  ng-focus/>
            <button class="timer "  ng-show="!vershow">{{sms_verify}}</button>
            <button class="timer  timerwc" ng-click="send_sms()" ng-show="vershow" ng-disabled="myForm2.yanzhengma.$dirty && myForm2.yanzhengma.$invalid && !myForm2.yanzhengma.$focused">{{sms_verify}}</button>
          </div>
          <div class="form-field username">
            <input type="text" name="qy_name" placeholder="企业名字(汉字、至少4位以上)" autocomplete="off" ng-model="qy_name" required class="form-control text" ng-minlength="4" ng-pattern="/^[\u4e00-\u9fa5]+$/"  required ng-focus />
            <!--ng-pattern="/(\\n\\S|测试|test)/"-->            
          </div>
          
          <div class="form-field username">
            <input type="text" name="user_name" placeholder="您的名字" autocomplete="off" ng-model="user_name"  class="form-control name" required ng-focus />
          </div>

          <div class="form-field">
            <input type="password" placeholder="密码（字母，数字，至少6位）" autocomplete="off" name="user_pwd" ng-model="user_pwd" required class="form-control password" ng-minlength="6" ng-maxlength="16" ng-focus />
          </div>
          <div class="form-field">
            <button class="btn btn-default" ng-click="usercode = true" ng-show="!usercode">邀请码</button>
            <input type="text" placeholder="邀请码(如果不正确将没有邀请人)"  ng-show="usercode" name="code" ng-model="code" class="form-control" ng-focus />  
          </div>
         <!-- <div class="form-field">
             <input type="radio" ng-value="1" checked="checked" ng-model="registerType"><span>企业</span>            
             <input type="radio" ng-value="2" ng-model="registerType"><span>培训机构</span>
          </div>-->
          <div class="form-field">
              <div ng-class="{'active':registerType==1}" ng-click="selectType(1)" style="border-radius: 3px; border:1px #ddd solid; padding: 10px; width: 150px; float: left; text-align: center; cursor: pointer;"><i class="iconfont">&#xe713;</i>组织内部培训</div>
              <div ng-class="{'active':registerType==2}" ng-click="selectType(2)" style="border-radius: 3px; border:1px #ddd solid; padding: 10px; width: 150px; float: left; text-align: center;cursor: pointer; margin-left: 5px;"><i class="iconfont">&#xe685;</i>课程(知识)付费</div>
          </div>
           <div class="form-fidld errormsg" ng-show="myForm2.txt_verify.$dirty && myForm2.txt_verify.$invalid && !myForm2.txt_verify.$focused">
                <span ng-show="myForm2.txt_verify.$error.required">手机验证码不能为空。</span>                
           </div>
           <div class="form-fidld errormsg" ng-show=" myForm2.qy_name.$dirty && myForm2.qy_name.$invalid && !myForm2.qy_name.$focused">
                <span ng-show="myForm2.qy_name.$error.required || myForm2.qy_name.$invalid">企业名字四位以上的中文汉字。</span>                
           </div>
           <div class="form-fidld errormsg" ng-show="myForm2.user_name.$dirty && myForm2.user_name.$invalid && !myForm2.user_name.$focused">
                <span ng-show="myForm2.user_name.$error.required">您的名字不能为空。</span>                
           </div>         
           <div class="form-fidld errormsg" ng-show="myForm2.user_pwd.$dirty && (myForm2.user_pwd.$invalid ||myForm2.user_pwd.$error.minlength || myForm2.user_pwd.$error.maxlength) && !myForm2.user_pwd.$focused">
                <span ng-show="myForm2.user_pwd.$dirty && (myForm2.user_pwd.$invalid ||myForm2.user_pwd.$error.minlength || myForm2.user_pwd.$error.maxlength)&& !myForm2.user_pwd.$focused">密码不能为空，并且为6-16位字母、数字</span>          
           </div>
           
           <!--
           <div class="form-fidld errormsg" ng-show="!myForm2.qy_name.$error.pattern">   
           <span ng-show="!myForm2.qy_name.$error.pattern">企业名字非法。</span>    
           </div>
           -->

            <div class="form-fidld errormsg" ng-show="!sms_jsservertk">
                <span ng-show="!sms_jsservertk">请选择同意服务条款</span>
           </div>
           <!---&&!(myForm2.txt_verify.$error.required || myForm2.qy_name.$error.required ||myForm2.user_name.$error.required||myForm2.user_pwd.$dirty ) --->
           <div class="form-fidld errormsg" ng-show="unerr ">
                <span ng-show="unerr">{{unerr_msg}}</span>
           </div>

          <button type="submit" class="btn form_btn submit anim-blue-all" ng-click="exitOrg()"  ng-disabled="myForm2.$invalid||!sms_jsservertk">{{zhuce}}</button>
    			<div class="form-field">
    			     <div class="privacy-field" style="">
                <input type="checkbox" ng-model="sms_jsservertk">
                我已阅读并同意
                <a href="/" target="_blank">《极速培训服务条款》</a>                
              </div>
              <div class="info-field">已有账号？<a href="/login.html" class="backlogin">登录</a></div>
          </div>


        </form>
        <!-- 邮箱注册 -->
        <form class="auth-form email-form" ng-show="useremail" name="myForm3" novalidate>
		  <div class="topsigunp"><img src="/images/logo.png" alt=""></div>
         
          <div class="form-field">
            <input type="email" name="email" id="emailzcws" autocomplete="off" ng-model="username" class="form-control email" readonly="readonly"/>
          </div>
          
          <div class="form-field username">
            <input type="text" name="qy_name" placeholder="企业名字(汉字、至少4位以上)" autocomplete="off" ng-model="qy_name"  class="form-control text" ng-minlength="4" ng-pattern="/^[\u4e00-\u9fa5]+$/" required ng-focus />
          </div>
          
          <div class="form-field username">
            <input type="text" name="user_name" placeholder="您的名字" autocomplete="off" ng-model="user_name" class="form-control name" required ng-focus />
          </div>
          <div class="form-field">
            <input type="password" placeholder="密码（字母，数字，至少6位）" autocomplete="off"  name="user_pwd" ng-model="user_pwd" required class="form-control password" ng-minlength="6" ng-maxlength="16" ng-focus />
          </div>
           <div class="form-field">
            <button class="btn btn-default" ng-click="usercode = true" ng-show="!usercode">邀请码</button>
            <input type="text" placeholder="邀请码(如果不正确将没有邀请人)"  ng-show="usercode" name="code" ng-model="code" class="form-control" ng-focus />  
          </div>
          <!--<div class="form-field">
             <input type="radio" ng-value="1" checked="checked" ng-model="registerType"><span>企业</span>            
             <input type="radio" ng-value="2" ng-model="registerType"><span>培训机构</span>
          </div>-->
          
          <div class="form-field">
              <div ng-class="{'active':registerType==1}" ng-click="selectType(1)" style="border-radius: 3px; border:1px #ddd solid; padding: 10px; width: 150px; float: left; text-align: center; cursor: pointer; "><i class="iconfont">&#xe713;</i>组织内部培训</div>
              <div ng-class="{'active':registerType==2}" ng-click="selectType(2)" style="border-radius: 3px; border:1px #ddd solid; padding: 10px; width: 150px; float: left; text-align: center;cursor: pointer; margin-left: 5px;"><i class="iconfont">&#xe685;</i>课程(知识)付费</div>
          </div>
           <div class="form-fidld errormsg" ng-show="myForm3.qy_name.$dirty && myForm3.qy_name.$invalid && !myForm3.qy_name.$focused">
                <span ng-show="myForm3.qy_name.$error.required || myForm3.qy_name.$invalid ">企业名字四位以上的中文汉字。</span>                
           </div>
           <div class="form-fidld errormsg" ng-show="myForm3.user_name.$dirty && myForm3.user_name.$invalid && !myForm3.user_name.$focused">
                <span ng-show="myForm3.user_name.$error.required || myForm3.user_name.$invalid">您的名字不能为空。</span>
           </div>
           <div class="form-fidld errormsg" ng-show="!email_jsservertk">
                <span ng-show="!email_jsservertk">请选择同意服务条款</span>
           </div>
           <div class="form-fidld errormsg" ng-show="unerr&& !(myForm3.qy_name.$error.required|| myForm3.user_name.$error.required) ">
                <span ng-show="unerr">{{unerr_msg}}</span>
           </div>
           <!--企业名称已存在-->
           <div class="form-fidld errormsg" ng-show="exitOrgName">
                <span>当前企业名称已存在</span>
           </div>
            <div class="form-fidld errormsg" ng-show=" myForm3.user_pwd.$dirty && (myForm3.user_pwd.$invalid ||myForm3.user_pwd.$error.minlength || myForm3.user_pwd.$error.maxlength) && !myForm3.user_pwd.$focused">                
                <span ng-show="myForm3.user_pwd.$dirty && (myForm3.user_pwd.$invalid ||myForm3.user_pwd.$error.minlength || myForm3.user_pwd.$error.maxlength)&& !myForm3.user_pwd.$focused">密码不能为空，并且为6-16位字母、数字</span>
           </div>
           
          <button type="submit" class="btn form_btn submit anim-blue-all" ng-click="exitOrg()"  ng-disabled="myForm3.$invalid || !email_jsservertk||btn_disabled">{{zhuce}}</button>
			<div class="form-field">

			<div class="privacy-field" style="">
            <input type="checkbox"  ng-model="email_jsservertk"/>
            我已阅读并同意
            <a href="/" target="_blank">《极速培训服务条款》</a>
            
          </div>
          <div class="info-field">已有账号？<a href="/login.html" class="backlogin">登录</a></div>
          </div>


        </form>

            <!-- 注册成功 -->
    <form class="login-was-successful " ng-show="succregist">
				<div class="topsigunp"><img src="/images/logo.png" alt=""></div>
				<div class="login-successful-img"><i class="iconfont">&#xe602;</i></div>
        <div class="form-field"><div class="form_title">恭喜您注册成功！登录账号为
        <br/><span class="form_title_yx">{{username}}</span><br/> 
        <!--<span>5</span>秒自动登录，如页面未加载请点击下方按钮。-->
        </div></div>
         <button type="submit" class="btn form_btn submit" ng-click="ljlogin()" >立即登录</button>

    </form>


        <!-- 注册激活 -->
		<form class="email-form-activation" ng-show="succmail" name="myForm4">
    
          <div class="topsigunp"><img src="/images/logo.png" alt=""></div>
          <div class="info-field">
            <div class="form_title">注册激活邮箱已经发送至邮箱<br>
          <span class="form_title_yx">{{username}}</span><br>
          有效期为2小时
            </div>
          </div>
           
           <button type="button" class="btn form_btn submit" ng-show="!emailshow" ng-disabled="!emailshow">{{email_verify}}</button>
           <button type="button" class="btn form_btn submit" ng-show="emailshow" ng-click="result_email()" >重新激活邮件</button>

    </form>    
</div>
</div>
</div>
</section>
    <script src="/framework/lodash.min.js" type="text/javascript"></script>
    <script src="/framework/restangular/restangular.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.min.js"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.tpls.min.js"></script>
    <script src="/system/service/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="/system/service/personnelpathservice.js"></script>
    <script type="text/javascript">
        var mainApp = angular.module("registerApp", ['Common', 'personnelmanagementS']).config(['$locationProvider', function ($locationProvider) {
            $locationProvider.html5Mode({
                enabled: true,
                requireBase: false//必须配置为false，否则<base href=''>这种格式带base连接的地址才能解析
            });
        } ]);

        mainApp.directive('setFocus', function () {
            return function (scope, element) {
                element[0].focus();
            };
        });

        mainApp.directive('ngFocus', function () {
            //var FOCUS_CLASS = "ng-focused";
            return {
                restrict: 'A',
                require: 'ngModel',
                scope: {
                    newddObj: "=ddObj"
                },
                link: function (scope, element, attrs, ctrl) {
                    ctrl.$focused = true;
                    element.bind('focus', function (evt) {
                        //element.addClass(FOCUS_CLASS);
                        scope.$apply(function () {
                            ctrl.$focused = true;
                        });
                    }).bind('blur', function () {
                        //element.removeClass(FOCUS_CLASS);
                        scope.$apply(function () {
                            scope.newddObj = false;
                            ctrl.$focused = false;
                        })
                    })
                }
            }
        });


        mainApp.controller('validateCtrl', ['$scope', 'RequestUserService', 'RequestPopService', '$interval', '$location', 'sysUserInfo', '$http','Restangular', function ($scope, RM, RPS, $interval, $location, sysUserInfo, $http,Restangular) {

            Restangular.addFullRequestInterceptor(function(element, operation, route, url, headers, params, httpConfig) {     
                return {              
                    headers: {"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"}  
                };
            });
            $scope.unameregis = true; //注册第一步（display）
            $scope.unerr = false; //注册第二步error提示短信（display）
            $scope.unerr_msg = ''; //注册第二步error提示信息
            $scope.userinfo = false; //注册第二步短信（display）
            $scope.useremail = false; //注册第二步邮箱（display）
            $scope.succmail = false; //注册第三步邮箱（display）
            $scope.succregist = false; //注册成功
            $scope.sms_verify = '发送验证码'; //重新发送短信
            $scope.email_verify = '重新激活邮件(60)'; //重新发送邮件
            $scope.num1 = 60; //发送邮件倒计时
            $scope.num2 = 60; //发送短信倒计时
            $scope.vershow = true; //短信倒计时（display）
            $scope.emailshow = false; //邮件倒计时（display）
            $scope.smsFlag = false; //验证码不可用
            $scope.exitOrgName = false; //企业名称是否存在
            $scope.registerType = 1; //注册类型  1企业，2培训机构         
            $scope.code = $location.search().c ? $location.search().c : ""; // 邀请码                        
            $scope.yanzhengma = ""; //验证码
            //判断是短信注册还是邮件注册
            $scope.sms_jsservertk = true;
            $scope.email_jsservertk = true;
            //控制注册按钮是否可用
            $scope.btn_disabled = false;
            $scope.zhuce = "注 册";
            // 计时器
            $scope.jishiqi = "";
            // 获得焦点时初始化参数
            $scope.userNameOnFocus = function () {
                $scope.unerr = false; //注册第二步error提示短信（display）
                $scope.unerr_msg = "";
            }
            //选择注册企业
            $scope.selectType = function (index) {
                $scope.registerType = index; //注册类型  1企业，2培训机构
            }

            //更新验证码
            $scope.upd_yzm = function () {
                //Restangular.one("/ApiUser/").customGET("verifyCode",
                RM.verifyCode({ useraccount: $scope.username }).then(function (users) {
                    if (users.errorcode == 0) {
                        $scope.loginerr = false;
                        $scope.valimgurl = users.imgsrc;
                    } else {
                        $scope.unerr = true;
                        $scope.unerr_msg = "验证码获取失败！";
                    }
                }, function errorCallback() {
                    $scope.unerr = true;
                    $scope.unerr_msg = "连接服务器失败！";
                });
            }
            //验证企业名称是否存在
            $scope.exitOrg = function () {
                if ($scope.qy_name.length > 0) {
                    RPS.searchOrgByName({ orgName: $scope.qy_name }).then(function (response) {
                        if (response.errorcode == 0) {
                            //企业名称已存在
                            if (response.datas.length > 0) {
                                $scope.unerr = true;
                                $scope.unerr_msg = "企业名称已存在！";
                            } else {
                                $scope.sms_register();
                            }
                        } else {
                            $scope.unerr = true;
                            $scope.unerr_msg = "企业验证错误！";
                        }
                    }, function errorCallback() {
                        $scope.unerr = true;
                        $scope.unerr_msg = "连接服务器失败！";
                    });
                }
            }
            //用户注册
            $scope.register1 = function () {
                //验证是否邮箱
                var username1 = $scope.username;
                //验证用户帐号是否存在                
                //                Restangular.one("/ApiUser/").customPOST({ name: "My Message" }, "isAccount",
                RM.isAccount({ useraccount: $scope.username }).then(function (retData) {
                    if (retData.errorcode == "4") {
                        $scope.unerr = false;
                        $scope.unerr_msg = '';
                        //4账号不存在（成功） 1账号已存在 3账号格式不正确 5连接不上数据库 6系统内部错误
                        if (username1.indexOf("@") >= 1) {
                            $scope.unameregis = false;
                            $scope.useremail = true;
                        } else {
                            $scope.unameregis = false;
                            $scope.userinfo = true;
                            $scope.upd_yzm();
                            //短信发送倒计时
                            //                            $interval(function () {
                            //                                if ($scope.num2 <= 0) {
                            //                                    $scope.sms_verify = "重发验证码";
                            //                                    $scope.vershow = true;
                            //                                } else {
                            //                                    $scope.sms_verify = "重新发送(" + $scope.num2 + ")";
                            //                                    $scope.num2 = $scope.num2 - 1;
                            //                                }
                            //                            }, 1000);

                        }
                    } else {
                        $scope.unerr = true;
                        if (retData.errorcode == "1") { $scope.unerr_msg = "账号已存在"; }
                        if (retData.errorcode == "3") { $scope.unerr_msg = "账号格式不正确"; }
                        if (retData.errorcode == "5") { $scope.unerr_msg = "连接不上数据库"; }
                        if (retData.errorcode == "6") { $scope.unerr_msg = "系统内部错误"; }
                    }
                }, function errorCallback() {
                    $scope.unerr = true;
                    $scope.unerr_msg = "连接服务器失败！";
                });
            };

            //用户发送短信验证码
            $scope.send_sms = function () {
                if ($scope.yanzhengma.length <= 0) {
                    $scope.unerr = true;
                    $scope.unerr_msg = "请输入验证码";
                    return;
                }
                $scope.unerr = false;
                $scope.unerr_msg = '';
                $scope.smsFlag = false;
                //                if ($scope.yanzhengma == undefined || $scope.yanzhengma == null || $scope.yanzhengma == "") {
                //                    $scope.smsFlag = true;
                //                    //$scope.sms_verify = "验证码不能为空";
                //                    return;
                //                }
                $scope.num2 = 60;
                $scope.vershow = false;
                //Restangular.one("/ApiUser/").customPOST({ name: "My Message" }, "sendSMS",
                RM.sendSMS({ useraccount: $scope.username, option: "insert", code: $scope.yanzhengma }).then(function (retData) {
                    //短信发送倒计时
                    if (!$scope.jishiqi) {
                        $scope.jishiqi = $interval(function () {
                            if ($scope.num2 <= 0) {
                                $scope.sms_verify = "重发验证码";
                                $scope.vershow = true;
                            } else {
                                $scope.sms_verify = "重新发送(" + $scope.num2 + ")";
                                $scope.num2 = $scope.num2 - 1;
                            }
                        }, 1000);
                    }
                    if (retData.errorcode == undefined || retData.errorcode == null || retData.errorcode == "") {
                        //                    errorcode true string 返回信息： 0发送成功 （2账号已存在 3账号信息有误）【防止恶意修改】 5连接不上数据库 6系统内部错误
                        console.log(retData);

                    } else {
                        $scope.unerr = true;
                        $scope.sms_verify = "发送验证码";
                        $scope.vershow = true;
                        $scope.jishiqi = "";
                        $scope.num2 = 0;

                        if (retData.errorcode == "3") { $scope.unerr_msg = "账号信息有误"; }
                        if (retData.errorcode == "5") { $scope.unerr_msg = "连接不上数据库"; }
                        if (retData.errorcode == "6") { $scope.unerr_msg = "系统内部错误"; }
                        if (retData.errorcode == "14") { $scope.unerr_msg = "图片验证码有误,请重新输入"; }
                        if (retData.errorcode == "45") { $scope.unerr_msg = "图片验证码过期"; }
                    }
                }, function errorCallback() {
                    $scope.unerr = true;
                    $scope.unerr_msg = "连接服务器失败！";
                });
            }

            //短信注册
            $scope.sms_register = function () {
                $scope.unerr = false;
                $scope.btn_disabled = true;
                $scope.unerr_msg = '';
                $scope.zhuce = "注 册 中";

                    RM.register({ useraccount: $scope.username, usercode: $scope.txt_verify, enterprisename: $scope.qy_name, username: $scope.user_name, userpwd: $scope.user_pwd, authoritys: $scope.mid, registerType: $scope.registerType, code: $scope.code }).then(function (retData) {
                        $scope.menuids = [];

                        if (retData.errorcode == "7" || retData.errorcode == "8") {
                            if (retData.errorcode == "7") {
                                $scope.succregist = true; //显示注册成功
                                $scope.userinfo = false;

                                RM.login({ useraccount: $scope.username, userpwd: $scope.user_pwd, code: "" }).then(function (users) {
                                    sysUserInfo.setuserinfotoken(users.token);
                                    RPS.personnelGetKey({ user_ID: users.data.userId }).then(function (retobj) {
                                        if (retobj.errorcode == 0) {
                                            retobj.data.userId = retobj.data.user_ID;
                                            retobj.data.username = retobj.data.user_Name;
                                            if (retobj.data.user_Img == "" || retobj.data.user_Img == null || retobj.data.user_Img == undefined) {
                                                retobj.data.user_Img = "/images/avatar.png";
                                            }
                                            sysUserInfo.setuserinfo(retobj.data);
                                        }
                                        if (users.data.powerLV == 99) {//学员登录                                
                                            window.location.href = "/member/index.html";
                                        } else {
                                            window.location.href = "/system/index.html";
                                        }
                                    });
                                });
                                //retData.data //用户对象（statecode为0时有数据）
                            } else if (retData.errorcode == "8") {

                                //显示注册成功
                                $scope.succmail = true;
                                $scope.useremail = false;
                                $scope.num1 = 60;
                                //邮箱发送倒计时
                                if (!$scope.jishiqi) {
                                    $scope.jishiqi = $interval(function () {
                                        if ($scope.num1 <= 0) {
                                            $scope.email_verify = "重新激活邮件";
                                            $scope.emailshow = true;
                                        } else {
                                            $scope.email_verify = "重新激活邮件(" + $scope.num1 + ")";
                                            $scope.num1 = $scope.num1 - 1;
                                        }
                                    }, 1000);
                                }
                                //RM.login({ useraccount: $scope.username, userpwd: $scope.user_pwd, code: "" }).then(function (users) {
                                //    sysUserInfo.setuserinfo(users.data);
                                //    window.location.href = "/system/index.html";
                                //});
                            }
                            //                            RM.login({ useraccount: $scope.username, userpwd: $scope.user_pwd, code: "" }).then(function (users) {
                            //                                sysUserInfo.setuserinfotoken(users.token);
                            //                                RPS.personnelGetKey({ user_ID: users.data.userId }).then(function (retobj) {
                            //                                    if (retobj.errorcode == 0) {
                            //                                        retobj.data.userId = retobj.data.user_ID;
                            //                                        retobj.data.username = retobj.data.user_Name;
                            //                                        if (retobj.data.user_Img == "" || retobj.data.user_Img == null || retobj.data.user_Img == undefined) {
                            //                                            retobj.data.user_Img = "/images/avatar.png";
                            //                                        }
                            //                                        sysUserInfo.setuserinfo(retobj.data);
                            //                                    }
                            //                                    if (users.data.powerLV == 99) {//学员登录                                
                            //                                        window.location.href = "/member/index.html";
                            //                                    } else {
                            //                                        window.location.href = "/system/index.html";
                            //                                    }
                            //                                });
                            //                            });
                        } else {
                            $scope.unerr = true;
                            $scope.btn_disabled = false;
                            $scope.zhuce = "注 册";
                            if (retData.errorcode == "3") { $scope.unerr_msg = "账号输入有误！"; }
                            else if (retData.errorcode == "2") { $scope.unerr_msg = "账号存在！"; }
                            else if (retData.errorcode == "9") { $scope.unerr_msg = "手机验证码输入不正确！"; }
                            else if (retData.errorcode == "5") { $scope.unerr_msg = "连接不上数据库！"; }
                            //                else if (retData.errorcode == "6") {$scope.unerr_msg = "系统内部有误！";} 
                            else if (retData.errorcode == "16") { $scope.unerr_msg = "注册失败 ！"; }
                            else if (retData.errorcode == "10") { $scope.unerr_msg = "手机验证码输入超时 ！"; }
                            else if (retData.errorcode == "14") { $scope.unerr_msg = "验证码有误,请重新输入"; }
                            else if (retData.errorcode == "45") { $scope.unerr_msg = "图片验证码过期"; }
                            //                else if (retData.errorcode == "17") { $scope.unerr_msg = "账号注册成功  ！"; } 
                        }

                    }, function errorCallback() {
                        $scope.btn_disabled = false;
                        $scope.zhuce = "注 册";
                        $scope.unerr = true;
                        $scope.menuids = [];
                        $scope.unerr_msg = "连接服务器失败！";
                    });
                //console.log($scope.username + "|" + $scope.txt_verify + "|" + $scope.qy_name + "|" + $scope.user_name + "|" + $scope.user_pwd + "|");
            }

            //邮箱注册
            $scope.email_register = function () {
                $scope.zhuce = "注 册 中";
                $scope.sms_register();
            }

            //重新发送激活邮箱
            $scope.result_email = function () {
                $scope.unerr = false;
                $scope.unerr_msg = '';
                $scope.num1 = 60;
                $scope.emailshow = false;
                //Restangular.one("/ApiUser/").customPOST({ name: "My Message" }, "sendEmail",
                RM.sendEmail({ option: "updateActive", useraccount: $scope.username }).then(function (retData) {
                    if (retData.errorcode == "0") {
                        //                    errorcode true string 返回信息： 0发送成功 （2账号已存在 3账号信息有误）【防止恶意修改】 5连接不上数据库 6系统内部错误


                        console.log(retData);
                    } else {
                        $scope.unerr = true;
                        if (retData.errorcode == "3") {
                            $scope.unerr_msg = "账号信息有误";
                        } else if (retData.errorcode == "5") {
                            $scope.unerr_msg = "连接不上数据库";
                        } else if (retData.errorcode == "6") {
                            $scope.unerr_msg = "系统内部错误";
                        } else if (retData.errorcode == "20") {
                            $scope.unerr_msg = "帐号已激活";
                        } else if (retData.errorcode == "21") {
                            $scope.unerr_msg = "未发送邮件";
                        }
                    }
                }, function errorCallback() {
                    $scope.unerr = true;
                    $scope.unerr_msg = "连接服务器失败！";
                });

                console.log("重新发送激活邮箱");
            }
            //立即登录
            $scope.ljlogin = function () {
                //$location.path('/login').replace();
                window.location.href = "/login.html";
            }

            $scope.mid = "546ffed1e133eced9c9baf54363fcd82,e34fa07de133c70710a7c269b5caad31,4ccd86385133c70710a6eeed15e277aa,ee0715bbf133c834dc1cb4580ccfd31a,d5431a3c2133c834dc1cdcea067f76fd,85921213f1341781ceab9b129cfa289e,d0b86aaa7133c707114d1b650d67505f,dadd7e256133c831fb66890c7977751b,530e2a10c133c831fb6702a3714f44e5,5f6c8e231133c831fb7803af90b51050,77de3ae73133c707114b70d03e962bb7,d1f9cb576133ecec11574212c7ca5a53,4605b3b3c133ecec115783dd66222cb4,4bcb8f9fe133ecec1157c4174fdcb0d9,56204a185133ecec1158f50645678a5b,93c1f2b95133c70710a991d82fe414d0,93c1f2b95133c70710a991d82fe414ss,b303eda99133c834db7b65dad3d1cfd9,5e2f2744d133c834db7d237b7cb0ed4b,d088a5748133c834db7d668db6e3ba13,10cec3de3133c70710a9e75b96fa958e,bc8fc96cd133c834dbc6769faf538397,cd47a25dd133c834dbc6a7a3a7e9c432,c42031d5e133c834dbc6d6d07b1d5e4f,6abd5fdcf133c63f10436fa3cd629803,e8c52e406133c70710aa2a56e0380336,c9c06d2131341781ce9bf97c368d9dd7,5941f52bc133ecec11aecec5ff2be86c,7129dd040133ecec11af1426c75c046d,db49d730b133ecec1230b5f2acfaab61,2ce6c9301133ecec1230fcee4e90c21c,bd78a2f62133ecec123139ddb1d6052a,958033267133ecec11af52e7f331bc64,21135c76a133ee15cbc6fe7018213f3a,f9911141c133ee15cd179785ef0eeaeb,cc90c823c133ef41fc4825519340e9d0,d52b77311134158b105bed195755b6fc,7a6e75a25133ee15e5a7919b2bca76f7,6710f5ef7133ee15e5a7e4e4078844ea,e11aab484133ee15e5a82538116eb533,04b9678af133ee15e5a87349db228129,f3c7fb234133ee15e624e3a4f161cbff,38c7cbea5133ee15e64d8aed7cfda826,15a7e3d2a133ee15e65725fd22cc6817,50aa29c34133ee15f670912083d9a64c,2f9a98b35133ee15e673fc114db890f1,34febf1ff133ee15e69af99b6dede896,936b7d6bd133ee15e789149d4f911be0,77358ca34133ee15e7f08e19860fba6e,4be759b29133ee15e788d2780f59fd4c,8de2cb16f133c5dd1067e1c4b15c8fb5,6a9b0d5f8133c63f103ecd5fe0915873,29baf8a9d133c5dd1091f41e1d6788c4,1a7fcde02133c5dd10933de2f9915270,153441904133c5dd10939363c3254d7b,5b820605e133c5dd106335caec6fdfac,2o5205e90133c60d14ce450a5c6f0b49,617a8c953133c5dd1064eafc6f0dee37,e81b71ff9133c63df9d8d5ded63a9905,cb33c66bd133c63df9df44c5e41d4c5d,33cb19a4c133c63df9f400d7d74c3915,617a8c953133c5dd1064eafc6f0dee39,5922381e1133c63dfa1ad615ca11e817,595ca47df133c63dfa1b2f04f5e8a536,77ea5420c133c63dfa1b7f343830631b,617a8c953133c5dd1064eafc6f0dee38,192c8f928133c63df9fe3eabcebaac0a,45d653c03133c63df9fec799bf360488,7f2034cda133c63df9ff485ffb4135c9,6e495ac3e133ed519992249925a7b9d6,4f52f5704133ed519a2de1568c4bdce4,d5d065d8a133ed51ced3fcaccce3948d,ca22c1b6a133ed51ced80b02cc6f2bcd,7a2e802b4133ed51ceebbc66cf7a02f4,95b30129b133ed50c96f08371b4b78dd,c957d4ee3133ed50c9b8e7be01da8701,a1976e8b9133ed50c9bcacbc2c57756f,6bba78d65133ed50c9c101a3181465dc,2488c5145133edb3ca1ac6d68d7259e3,0f205598d133ef45dcfe4559c983ae7f,aa72179b3133ef45eafec00ce04b885c,3b41be93a134177ea0e059cffe9b0f0f,a7f00a93e134177ea0e549e5a308943a,5ad759590134177ea0e78e0f4eebe913,45bddadd4133f0d4b09466226c08f050,c785dcd57133f0d4b0b948ebb68bd8f3,fd714f20e133f0d4b0bba4b68cff3032,9005fcea81341462f7b6441bd7bd152e,da6d05af51341462f7d7bb0ef562f08b,bdebf16021341462f7da9e303897e826,d05c81870133eeddc7c5d117fd9cdf54,d7b0e01de133ef45dd0840eaff2d022e,58a15bb35133f071a0140a8c02a7bcf1,deb9274f9133ef419b1b5383d0bdc319,9f657d804133edb3d66f3c3f53382937,99a04b351133edb58d874d9b43d0a2c2,3d9017024133edb58da18d13c571df8d,17b886090133edb58da1cd3e22d2a059,b14797e39133edb58da2152a5a0ce277";
        } ]);

    </script>
    <script src="/system/service/userpathservice.js" type="text/javascript"></script>
</body>
</html>
